package com.sedu.manage.service.impl;

import java.util.List;
import com.sedu.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sedu.manage.mapper.LeaveRequestMapper;
import com.sedu.manage.domain.LeaveRequest;
import com.sedu.manage.service.ILeaveRequestService;

/**
 * 请假管理Service业务层处理
 * 
 * @author yulinfeng
 * @date 2025-03-29
 */
@Service
public class LeaveRequestServiceImpl implements ILeaveRequestService 
{
    @Autowired
    private LeaveRequestMapper leaveRequestMapper;

    /**
     * 查询请假管理
     * 
     * @param leaveId 请假管理主键
     * @return 请假管理
     */
    @Override
    public LeaveRequest selectLeaveRequestByLeaveId(Long leaveId)
    {
        return leaveRequestMapper.selectLeaveRequestByLeaveId(leaveId);
    }

    /**
     * 查询请假管理列表
     * 
     * @param leaveRequest 请假管理
     * @return 请假管理
     */
    @Override
    public List<LeaveRequest> selectLeaveRequestList(LeaveRequest leaveRequest)
    {
        return leaveRequestMapper.selectLeaveRequestList(leaveRequest);
    }

    /**
     * 新增请假管理
     * 
     * @param leaveRequest 请假管理
     * @return 结果
     */
    @Override
    public int insertLeaveRequest(LeaveRequest leaveRequest)
    {
        leaveRequest.setCreateTime(DateUtils.getNowDate());
        return leaveRequestMapper.insertLeaveRequest(leaveRequest);
    }

    /**
     * 修改请假管理
     * 
     * @param leaveRequest 请假管理
     * @return 结果
     */
    @Override
    public int updateLeaveRequest(LeaveRequest leaveRequest)
    {
        leaveRequest.setUpdateTime(DateUtils.getNowDate());
        return leaveRequestMapper.updateLeaveRequest(leaveRequest);
    }

    /**
     * 批量删除请假管理
     * 
     * @param leaveIds 需要删除的请假管理主键
     * @return 结果
     */
    @Override
    public int deleteLeaveRequestByLeaveIds(Long[] leaveIds)
    {
        return leaveRequestMapper.deleteLeaveRequestByLeaveIds(leaveIds);
    }

    /**
     * 删除请假管理信息
     * 
     * @param leaveId 请假管理主键
     * @return 结果
     */
    @Override
    public int deleteLeaveRequestByLeaveId(Long leaveId)
    {
        return leaveRequestMapper.deleteLeaveRequestByLeaveId(leaveId);
    }
}
